import axios from "axios";
import { formatDate } from "element-ui/src/utils/date-util";
import { Form } from "element-ui";

const url = "https://bjsf.bjsky.top/";
const urls = "https://bjsf.bjsky.top/";
// const url = "http://bjsf.bjsky.top/";
// const urls = "http://bjsf.bjsky.top/";
let token = sessionStorage.getItem("token");

// 登录
export function login(user_name, pwd) {
  let formdata = new FormData();
  formdata.append("user_name", user_name);
  formdata.append("pwd", pwd);
  return axios.post(url + "admin/login/login", formdata);
}
// 商家登录
export function login2(telephone, password) {
  let formdata = new FormData();
  formdata.append("telephone", telephone);
  formdata.append("password", password);
  return axios.post(url + "admin/login/sellerLogin", formdata);

}

// 退出登录
export function outLogin(token) {
  let fromdata = new FormData();
  fromdata.append("token", token);
  return axios.post(url + "admin/login/outLogin", fromdata);
}
export function outSellerLogin(token, seller_user_id) {
  let fromdata = new FormData();
  fromdata.append("token", token);
  fromdata.append("seller_user_id", seller_user_id);
  return axios.post(url + 'admin/login/outSellerLogin', fromdata)
}

// 修改密码
export function serPassword(token, user_name, pwd, new_pwd) {
  let fromdata = new FormData();
  fromdata.append("token", token);
  fromdata.append("user_name", user_name);
  fromdata.append("pwd", pwd);
  fromdata.append("new_pwd", new_pwd);
  return axios.post(url + "admin/user/up_pwd", fromdata);
}

// 获取用户列表
export function getUserList(
  token,
  page,
  limit,
  mobile,
  id,
  nickname,
  pid_mobile
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("mobile", mobile);
  formdata.append("id", id);
  formdata.append("nickname", nickname);
  formdata.append("pid_mobile", pid_mobile);
  return axios.post(url + "admin/user/user_list", formdata);
}

// 获取商品列表
export function getShopList(
  token,
  page,
  limit,
  user_id,
  order_id,
  status,
  payStatus,
  ship_status,
  order_type,
  order_sh_name,
  order_time
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("user_id", user_id);
  formdata.append("order_id", order_id);
  formdata.append("status", status);
  formdata.append("pay_status", payStatus);
  formdata.append("ship_status", ship_status);
  formdata.append("order_type", order_type);
  formdata.append("order_sh_name", order_sh_name);
  formdata.append("order_time", order_time);
  return axios.post(url + "admin/order/order_list", formdata);
}

// 上传文件
export function uploadFilec(files) {
  let formdata = new FormData();
  formdata.append("files", files);
  return axios.post(url + "lib/Upload/upload_file", formdata);
}

// 修改用户数据
export function setUserData(token, user_id, data) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("user_id", user_id);
  formdata.append("data", data);
  return axios.post(url + "admin/user/up_user_info", formdata);
}

export function orderDetails(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/order/order_index", formdata);
}

// 获取员工申请列表
export function employeeList(token, page, limit, name) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  return axios.post(url + "admin/user/user_po_list", formdata);
}

//保存员工信息
export function saveEmployee(token, id, status, user_skill, names) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("status", status);
  formdata.append("user_skill", user_skill);
  formdata.append("names", names);
  return axios.post(url + "admin/user/user_po_up_status", formdata);
}

// 修改订单信息
export function setMessage(token, title, key, val, data) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("title", title);
  formdata.append("key", key);
  formdata.append("val", val);
  formdata.append("data", data);
  return axios.post(url + "admin/Common/up_data", formdata);
}

//售后申请列表
export function shouhouList(
  token,
  page,
  limit,
  status,
  type,
  aftersales_id,
  order_id,
  order_type
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("status", status);
  formdata.append("type", type);
  formdata.append("aftersales_id", aftersales_id);
  formdata.append("order_id", order_id);
  formdata.append("order_type", order_type);
  return axios.post(url + "admin/BillAftersales/aftersales_list", formdata);
}

export function shouhoushenhe(
  token,
  aftersales_id,
  refund,
  items,
  type,
  status,
  mark
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("aftersales_id", aftersales_id);
  formdata.append("refund", refund);
  formdata.append("items", items);
  formdata.append("type", type);
  formdata.append("status", status);
  formdata.append("mark", mark);
  return axios.post(url + "admin/order/audit", formdata);
}

// 退货单
export function returnGoods(
  token,
  page,
  limit,
  reship_id,
  order_id,
  aftersales_id,
  logi_no,
  status,
  order_type
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("reship_id", reship_id);
  formdata.append("order_id", order_id);
  formdata.append("aftersales_id", aftersales_id);
  formdata.append("logi_no", logi_no);
  // formdata.append("mobile", mobile);
  formdata.append("status", status);
  formdata.append("order_type", order_type);
  return axios.post(url + "admin/BillReship/Reship_list", formdata);
}

// 换货单
export function changeGoods(
  token,
  page,
  limit,
  change_id,
  order_id,
  aftersales_id,
  logi_no,
  mobile,
  status,
  order_type
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("mobile", mobile);
  formdata.append("order_id", order_id);
  formdata.append("change_id", change_id);
  formdata.append("aftersales_id", aftersales_id);
  formdata.append("status", status);
  formdata.append("logi_no", logi_no);
  formdata.append("order_type", order_type);
  return axios.post(url + "admin/BillChange/Change_list", formdata);
}

// 确认退货
export function verifyExitGoods(token = token, reship_id, logi_code, logi_no) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("reship_id", reship_id);
  formdata.append("logi_code", logi_code);
  formdata.append("logi_no", logi_no);
  return axios.post(url + "admin/BillReship/confirmReship_Status", formdata);
}

// 确认收货单
export function verifyReceiveGoods(token, reship_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("reship_id", reship_id);
  return axios.post(url + "admin/BillReship/confirmReship", formdata);
}

// 商品列表
export function goodsList(
  token,
  page,
  limit,
  goods_type_id,
  brand_id,
  marketable,
  name,
  bn,
  status,
  goods_cat_id,
  category_id,
  materials
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  formdata.append("bn", bn);
  formdata.append("status", status);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("brand_id", brand_id);
  formdata.append("marketable", marketable);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("category_id ", category_id);
  formdata.append("materials", materials);
  return axios.post(url + "admin/goods/goods_list", formdata);
}

// 辅材列表
export function goodsListmo(token, page, limit, name, bn, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  formdata.append("bn", bn);
  formdata.append("status", status);
  return axios.post(url + "admin/goods/goods_listmo", formdata);
}

// 商品分类管理
export function goodsSort(token, page, limit, tpye = 1) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("type", tpye);
  return axios.post(url + "admin/GoodsCat/gettopcat", formdata);
}

// 保存商品编辑
export function saveGoodSet(
  token,
  name,
  goods_cat_id,
  brand_id,
  goods_type_id,
  price,
  costprice,
  mktprice,
  weight,
  stock,
  unit,
  images,
  marketable,
  is_hot,
  id,
  bn,
  specifications,
  brand,
  nums,
  sell_num,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("unit", unit);
  formdata.append("images", images);
  formdata.append("marketable", marketable);
  formdata.append("is_hot", is_hot);
  formdata.append("id", id);
  formdata.append("bn", bn);
  formdata.append("specifications", specifications);
  formdata.append("brand", brand);
  formdata.append("nums", nums);
  formdata.append("sell_num", sell_num);
  return axios.post(url + "admin/goods/goods_up", formdata);
}

// 保存辅材编辑
export function saveGoodSetmo(
  token,
  name,
  goods_cat_id,
  brand_id,
  brand,
  goods_type_id,
  price,
  costprice,
  mktprice,
  weight,
  stock,
  unit,
  images,
  marketable,
  is_hot,
  id,
  bn,
  specifications,
  Length,
  width,
  height,
  colour,
  volume,
  model,
  intro
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("brand", brand);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("unit", unit);
  formdata.append("images", images);
  formdata.append("marketable", marketable);
  formdata.append("is_hot", is_hot);
  formdata.append("id", id);
  formdata.append("bn", bn);
  formdata.append("specifications", specifications);
  formdata.append("Length", Length);
  formdata.append("width", width);
  formdata.append("height", height);
  formdata.append("colour", colour);
  formdata.append("volume", volume);
  formdata.append("model", model);
  formdata.append("intro", intro);
  return axios.post(url + "admin/goods/goods_upmo", formdata);
}

// 添加商品
export function addGood(
  token,
  name,
  goods_cat_id,
  brand_id,
  goods_type_id,
  price,
  costprice,
  mktprice,
  weight,
  stock,
  unit,
  images,
  marketable,
  is_hot,
  bn,
  specifications,
  sell_num,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("unit", unit);
  formdata.append("images", images);
  formdata.append("marketable", marketable);
  formdata.append("is_hot", is_hot);
  formdata.append("bn", bn);
  formdata.append("specifications", specifications);
  formdata.append("sell_num", sell_num);
  return axios.post(url + "admin/goods/doAdd", formdata);
}

export function addmaterials(
  token,
  name,
  goods_cat_id,
  brand_id,
  brand,
  goods_type_id,
  price,
  costprice,
  mktprice,
  weight,
  stock,
  unit,
  images,
  marketable,
  is_hot,
  bn,
  specifications,
  Length,
  width,
  height,
  colour,
  volume,
  model,
  intro
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("brand", brand);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("unit", unit);
  formdata.append("images", images);
  formdata.append("marketable", marketable);
  formdata.append("is_hot", is_hot);
  formdata.append("bn", bn);
  formdata.append("specifications", specifications);
  formdata.append("Length", Length);
  formdata.append("width", width);
  formdata.append("height", height);
  formdata.append("colour", colour);
  formdata.append("volume", volume);
  formdata.append("model", model);
  formdata.append("intro", intro);
  return axios.post(url + "admin/Goods/doAddmo", formdata);
}

// 控制上下架
export function up_down(token, ids, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("ids", ids);
  formdata.append("type", type);
  return axios.post(url + "admin/goods/batchMarketable", formdata);
}

// 获取商品全部品牌
export function allBrand(token, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("type", type);
  return axios.post(url + "admin/goods/brand_list", formdata);
}

// 获取商品分类
export function goodSort(token, type, materials) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("type", type);
  formdata.append("materials", materials);
  return axios.post(url + "admin/GoodsCat/getAllCat", formdata);
}

// 品牌列表
export function brandList(token, page, limit, name, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  formdata.append("type", type);
  return axios.post(url + "admin/order/brand_list", formdata);
}

// 添加商品分类
export function addSort(token, parent_id, name, sort, image, status, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("parent_id", parent_id);
  formdata.append("name", name);
  formdata.append("sort", sort);
  formdata.append("image", image);
  formdata.append("status", status);
  formdata.append("type", type);
  return axios.post(url + "admin/GoodsCat/cat_add", formdata);
}

// 获取下级商品分类
export function goodsSonSort(token, page, limit, id, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("id", id);
  formdata.append("type", type);
  return axios.post(url + "admin/GoodsCat/getlowercat", formdata);
}

// 删除商品分类
export function deleteSort(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/GoodsCat/del", formdata);
}

// 修改商品分类
export function setSort(
  token,
  parent_id,
  id,
  name,
  sort,
  image,
  status,
  type = 1
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("parent_id", parent_id);
  formdata.append("id", id);
  formdata.append("name", name);
  formdata.append("sort", sort);
  formdata.append("image", image);
  formdata.append("status", status);
  formdata.append("type", type);
  return axios.post(url + "admin/GoodsCat/cat_up", formdata);
}

// 删除商品
export function deleteGoods(token, ids) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("ids", ids);
  return axios.post(url + "admin/goods/batchDel", formdata);
}

// 商品品牌更新
export function setBrand(token, name, logo, sort, id, type, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("logo", logo);
  formdata.append("sort", sort);
  formdata.append("id", id);
  formdata.append("type", type);
  formdata.append("status", status);
  return axios.post(url + "admin/order/brand_up", formdata);
}

// 添加商品品牌
export function addBrand(token, name, logo, sort, type, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("logo", logo);
  formdata.append("sort", sort);
  formdata.append("type", type);
  formdata.append("status", status);
  return axios.post(url + "admin/order/brand_add", formdata);
}

// 删除商品品牌
export function deleteBrand(token, id, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("type", type);
  return axios.post(url + "admin/order/brand_del", formdata);
}

// 支付单列表
export function payList(
  token,
  page,
  limit,
  source_id,
  status,
  id,
  trade_no,
  mobile
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("source_id", source_id);
  formdata.append("status", status);
  formdata.append("id", id);
  formdata.append("trade_no", trade_no);
  formdata.append("mobile", mobile);
  return axios.post(url + "admin/order/pay_list", formdata);
}

// 退款单列表
export function exitOrder(
  token,
  page,
  limit,
  status,
  refund_id,
  aftersales_id,
  // mobile,
  order_type
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("status", status);
  formdata.append("refund_id", refund_id);
  formdata.append("aftersales_id", aftersales_id);
  // formdata.append("mobile", mobile);
  formdata.append("order_type", order_type);
  return axios.post(url + "admin/BillRefund/Refund_list", formdata);
}

// 退款
export function refund(token, refund_id, money, order_id, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("refund_id", refund_id);
  formdata.append("money", money);
  formdata.append("order_id", order_id);
  formdata.append("status", status);
  return axios.post(url + "admin/order/tuikuan", formdata);
}

// 财务-----资金账户管理
export function balance_list(token, page, limit, source_id, type, mobile) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("source_id", source_id);
  formdata.append("type", type);
  formdata.append("mobile", mobile);
  return axios.post(url + "admin/order/balance_list", formdata);
}

// 财务------开票管理
export function invoiceList(
  token,
  page,
  limit,
  status,
  type,
  email,
  duty,
  name
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("status", status);
  formdata.append("type", type);
  formdata.append("email", email);
  formdata.append("duty", duty);
  formdata.append("name", name);
  return axios.post(url + "admin/user/invoice_list", formdata);
}

// 保存开票
export function saveInvoice(token, id, status, price, type, name, duty) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("status", status);
  formdata.append("price", price);
  formdata.append("type", type);
  formdata.append("name", name);
  formdata.append("duty", duty);
  return axios.post(url + "admin/user/invoice_up", formdata);
}

// 财务----提现列表
export function tixianList(token, page, limit, type, mobile) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("type", type);
  formdata.append("mobile", mobile);
  return axios.post(url + "admin/user/balance_list", formdata);
}

// 设置----平台设置
export function pingtaishezhi(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/config/config_index", formdata);
}

//设置----保存平台设置
export function saveSet(data, token) {
  let formdata = new FormData();
  formdata.append("data", data);
  formdata.append("token", token);
  return axios.post(url + "admin/config/config_up", formdata);
}

// 获取近七天订单量
export function getOrder(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/order/order_statistics", formdata);
}

// 获取会员统计
export function getUser(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/user/user_statistics", formdata);
}

// 客服聊天
export function getKefu(token, list_token, page, limit) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("list_token", list_token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  return axios.post(url + "admin/user/admin1_kefu_list", formdata);
}

// 客服删除聊天
export function kefuDeteleChat(token, chat_list_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("chat_list_id", chat_list_id);
  return axios.post(url + "admin/user/admin1_kefu_del", formdata);
}

// 管理员列表
export function adminList(token, page, limit) {
  let formatdate = new FormData();
  formatdate.append("token", token);
  formatdate.append("page", page);
  formatdate.append("limit", limit);
  return axios.post(url + "admin/user/admin_user_list", formatdate);
}

// 管理员添加
export function addAdmin(token, user_name, password, phone, role_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("user_name", user_name);
  formdata.append("password", password);
  formdata.append("phone", phone);
  formdata.append("role_id", role_id);
  return axios.post(url + "admin/user/admin_user_add", formdata);
}

// 管理员修改
export function setAdmin(token, user_name, password, phone, role_id, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("user_name", user_name);
  formdata.append("password", password);
  formdata.append("phone", phone);
  formdata.append("role_id", role_id);
  formdata.append("id", id);
  return axios.post(url + "admin/user/admin_user_up", formdata);
}

// 管理员删除
export function deleteAdmin(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/admin_user_del", formdata);
}

// 角色列表
export function roleList(token, page, limit, name) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);

  return axios.post(url + "admin/user/role_list", formdata);
}

// 获取所有角色
export function allList(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/user/role_", formdata);
}

// 添加角色
export function addRole(token, name, limits_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("limits_id", limits_id);

  return axios.post(url + "admin/user/role_add", formdata);
}

// 获取所有权限
export function getAuthority(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/user/limits_", formdata);
}

// 配置权限
export function setRole(token, name, parent_ids, child_ids, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("parent_ids", parent_ids);
  formdata.append("child_ids", child_ids);
  formdata.append("id", id);
  return axios.post(url + "admin/user/role_up", formdata);
}

// 删除角色
export function deleteRole(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/role_del", formdata);
}

// 获取所有订单的经纬度
export function orderLat(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/order/order_add_zuobiao", formdata);
}

// 财务统计
export function FINANCE(token, time) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("time", time);
  return axios.post(url + "admin/order/order", formdata);
}

// 员工数据
export function employeeDate(token, page, limit) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  return axios.post(url + "admin/user/user_work", formdata);
}

// 工人打卡记录
export function dakajilu(token, time, user_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("time", time);
  formdata.append("user_id", user_id);
  return axios.post(url + "admin/user/work_list", formdata);
}

// 完成订单

export function wancheng(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/order/complete", formdata);
}

// 取消订单
export function quxiao(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/order/compqvxiao", formdata);
}

// 获取浏览器iconfont
export function icontont() {
  return axios.post(url + "admin/config/config_shop_logo");
}

// 获取库存盘点
export function kucun(token, page, limit, time) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("time", time);
  return axios.post(url + "admin/Goods/pandian_list", formdata);
}

// 系统设置轮播图
export function swiperList(token, page, limit, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("type", type);
  return axios.post(url + "admin/user/lunbotu_list", formdata);
}

// 系统修改轮播图
export function swiperSet(token, id, img, is_show, urle, sort, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("img", img);
  formdata.append("is_show", is_show);
  formdata.append("url", urle);
  formdata.append("sort", sort);
  formdata.append("type", type);
  return axios.post(url + "admin/user/lunbotu_up", formdata);
}

// 系统删除轮播图
export function swiperDel(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/lunbotu_del", formdata);
}

// 系统添加轮播图
export function swiperAdd(token, img, is_show, urle, sort, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("img", img);
  formdata.append("is_show", is_show);
  formdata.append("url", urle);
  formdata.append("sort", sort);
  formdata.append("type", type);
  return axios.post(url + "admin/user/lunbotu_add", formdata);
}

// 进货更新
export function uldata(token, nums, user_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/Config/config_kt_time_up", formdata);
}

export function grade_list(token, page, limit) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  return axios.post(url + "admin/user/grade_list", formdata);
}

export function grade_up(token, id, name, number, fanli, beizhu) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("name", name);
  formdata.append("number", number);
  formdata.append("fanli", fanli);
  formdata.append("beizhu", beizhu);
  return axios.post(url + "admin/user/grade_up", formdata);
}

export function toolList(token, page, limit, type, types) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("type", type);
  formdata.append("types", types);
  return axios.post(url + "admin/Tool/tool_list", formdata);
}

export function toolAdd(token, name, moren, type, sort, types) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("moren", moren);
  formdata.append("type", type);
  formdata.append("sort", sort);
  formdata.append("types", types);
  return axios.post(url + "admin/Tool/tool_add", formdata);
}

export function toolSet(token, id, name, type, moren, sort, types) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("name", name);
  formdata.append("type", type);
  formdata.append("moren", moren);
  formdata.append("sort", sort);
  formdata.append("types", types);
  return axios.post(url + "admin/Tool/tool_up", formdata);
}

export function toolDelete(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/Tool/tool_del", formdata);
}

export function examine(token, id, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("type", type);
  return axios.post(url + "admin/user/examine", formdata);
}

export function construction_list(token, page, limit) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  return axios.post(url + "admin/user/construction_list", formdata);
}

export function construction_add(token, user_id, data) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("user_id", user_id);
  formdata.append("data", data);
  return axios.post(url + "admin/user/construction_add", formdata);
}

export function construction_del(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/construction_del", formdata);
}

export function construction_up(token, id, data) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("data", data);
  return axios.post(url + "admin/user/construction_up", formdata);
}

// 公告列表
export function notice_list(token, page, limit, title) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("title", title);
  return axios.post(url + "admin/user/notice_list", formdata);
}

// 添加公告
export function notice_add(token, title, content, status, rel_time) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("title", title);
  formdata.append("content", content);
  formdata.append("status", status);
  formdata.append("rel_time", rel_time);
  return axios.post(url + "admin/user/notice_add", formdata);
}

// 删除公告
export function notice_del(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/notice_del", formdata);
}

// 编辑公告
export function notice_up(token, id, title, content, status, rel_time) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("title", title);
  formdata.append("content", content);
  formdata.append("status", status);
  formdata.append("rel_time", rel_time);
  return axios.post(url + "admin/user/notice_up", formdata);
}

//员工管理
export function user_po_list(
  token,
  page,
  name,
  phone_number,
  limit,
  authority_id
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  formdata.append("phone_number", phone_number);
  formdata.append("authority_id", authority_id);
  return axios.post(url + "admin/user/user_po_list", formdata);
}

export function userDelete(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/user/user_shengqing_Del", formdata);
}

//添加员工
export function employee(token, img, phone_number, name, user_id, authority_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("img", img);
  formdata.append("phone_number", phone_number);
  formdata.append("name", name);
  formdata.append("user_id", user_id);
  formdata.append("authority_id", authority_id);
  return axios.post(url + "admin/user/user_authority", formdata);
}

//编辑
export function compileAuth(token, img, phone_number, name, user_id, authority_id, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("img", img);
  formdata.append("phone_number", phone_number);
  formdata.append("name", name);
  formdata.append("user_id", user_id);
  formdata.append("authority_id", authority_id);
  formdata.append("id", id);
  return axios.post(url + "admin/user/up_user_auth", formdata);
}

//上传文件
export function uploadFiles(files) {
  let formdata = new FormData();
  formdata.append("files", files);
  return axios.post(url + "lib/Upload/upload_file", formdata);
}

// https:/bjsf.bjsky.top/admin/user/user _shengqing
//用户状态
export function condition(token, id, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("status", status);
  return axios.post(url + "admin/user/user_shengqing", formdata);
}

//票务
//列表展示
export function ticketing(token, page, limit, name, waterCatId, isUp) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("name", name);
  formdata.append("water_cat_id", waterCatId);
  formdata.append("is_up", isUp);
  return axios.post(url + "admin/WaterPackage/Package_list", formdata);
}

//上下架
export function ticketUser(token, id, is_up) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("is_up", is_up);
  formdata.append("id", id);
  return axios.post(url + "admin/WaterPackage/Package_is_up", formdata);
}

//分类
export function classification(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/WaterPackage/Water_cat_list", formdata);
}

//添加信息
export function addition(
  token,
  water_name,
  water_number,
  goods_id,
  package_nember,
  is_up,
  water_img,
  water_cat_id,
  price,
  costprice,
  is_hot,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("water_name", water_name);
  formdata.append("water_number", water_number);
  formdata.append("goods_id", goods_id);
  formdata.append("package_nember", package_nember);
  formdata.append("is_up", is_up);
  formdata.append("water_img", water_img);
  formdata.append("water_cat_id", water_cat_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("is_hot", is_hot);
  return axios.post(url + "admin/WaterPackage/Package_add", formdata);
}

//修改
export function modification(
  token,
  id,
  water_name,
  water_number,
  goods_id,
  package_nember,
  is_up,
  water_img,
  water_cat_id,
  price,
  costprice,
  is_hot
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("water_name", water_name);
  formdata.append("water_number", water_number);
  formdata.append("goods_id", goods_id);
  formdata.append("package_nember", package_nember);
  formdata.append("is_up", is_up);
  formdata.append("water_img", water_img);
  formdata.append("water_cat_id", water_cat_id);
  formdata.append("price", price);
  formdata.append("costprice", costprice);
  formdata.append("is_hot", is_hot);
  return axios.post(url + "admin/WaterPackage/Package_up", formdata);
}

//删除
export function Package_del(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/WaterPackage/Package_del", formdata);
}

//定制水
//列表展示
export function customization(
  token,
  page,
  limit,
  goods_type_id,
  marketable,
  goods_cat_id,
  name,
  bn,
  status
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("bn", bn);
  formdata.append("status", status);
  formdata.append("name", name);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("marketable", marketable);
  return axios.post(url + "admin/goods/goods_list", formdata);
}

//添加定制水商品
export function doAdd(
  token,
  name,
  price,
  goods_type_id,
  unit,
  specifications,
  sell_num,
  logo_wart_type,
  goods_cat_id,
  brand_id,
  images,
  costprice,
  marketable,
  mktprice,
  weight,
  stock,
  is_hot,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("price", price);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("unit", unit);
  formdata.append("specifications", specifications);
  formdata.append("sell_num", sell_num);
  formdata.append("logo_wart_type", logo_wart_type);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("images", images);
  formdata.append("costprice", costprice);
  formdata.append("marketable", marketable);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("is_hot", is_hot);
  return axios.post(url + "admin/goods/doAdd", formdata);
}

//定制水分类
export function customized(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/goods/customized_cat_list", formdata);
}

//删除
export function batchDel(token, ids) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("ids", ids);
  return axios.post(url + "admin/goods/batchDel", formdata);
}

//修改
export function recompose(
  token,
  name,
  price,
  goods_type_id,
  unit,
  specifications,
  sell_num,
  logo_wart_type,
  goods_cat_id,
  brand_id,
  images,
  costprice,
  marketable,
  mktprice,
  weight,
  stock,
  id,
  is_hot,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("price", price);
  formdata.append("goods_type_id", goods_type_id);
  formdata.append("unit", unit);
  formdata.append("specifications", specifications);
  formdata.append("sell_num", sell_num);
  formdata.append("logo_wart_type", logo_wart_type);
  formdata.append("goods_cat_id", goods_cat_id);
  formdata.append("brand_id", brand_id);
  formdata.append("images", images);
  formdata.append("costprice", costprice);
  formdata.append("marketable", marketable);
  formdata.append("mktprice", mktprice);
  formdata.append("weight", weight);
  formdata.append("stock", stock);
  formdata.append("id", id);
  formdata.append("is_hot", is_hot);
  return axios.post(url + "admin/goods/goods_up", formdata);
}

//定制水订单
export function orderList(
  token,
  page,
  limit,
  order_id,
  status,
  pay_status,
  ship_status,
  order_type,
  order_sh_name,
  order_time,
  user_id
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("order_id", order_id);
  formdata.append("status", status);
  formdata.append("pay_status", pay_status);
  formdata.append("ship_status", ship_status);
  formdata.append("order_type", order_type);
  formdata.append("order_sh_name", order_sh_name);
  formdata.append("order_time", order_time);
  formdata.append("user_id", user_id);
  return axios.post(url + "admin/order/order_list", formdata);
}

//上下架
export function fluctuate(token, ids, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("ids", ids);
  formdata.append("type", type);
  return axios.post(url + "admin/goods/batchMarketable", formdata);
}

//定制水接单
export function takeOrders(token, order_id, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("order_id", order_id);
  formdata.append("type", type);
  return axios.post(url + "admin/order/order_service_status", formdata);
}

//定制水派单
export function delivery(token, order_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("order_id", order_id);
  return axios.post(url + "admin/order/order_service_ship", formdata);
}

//财务
// 员工提成
export function workList(token, page, limit, mobile, time, name, authority_id, names, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("mobile", mobile);
  formdata.append("time", time);
  formdata.append("name", name);
  formdata.append("names", names);
  formdata.append("type", type);
  formdata.append("authority_id", authority_id);
  return axios.post(url + "admin/user/user_work_list", formdata);
}

//员工提成详情
export function particular(token, page, limit, time, user_id,) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("time", time);
  formdata.append("user_id", user_id);
  return axios.post(url + "admin/user/user_work_index", formdata);
}

//售票统计
export function packageCount(
  token,
  page,
  limit,
  water_cat_id,
  time,
  water_name
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("limit", limit);
  formdata.append("page", page);
  formdata.append("water_cat_id", water_cat_id);
  formdata.append("time", time);
  formdata.append("water_name", water_name);
  return axios.post(url + "admin/WaterPackage/water_package_count", formdata);
}

//售票统计
// 明细
export function packageIndex(token, page, limit, id, time) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("limit", limit);
  formdata.append("page", page);
  formdata.append("id", id);
  formdata.append("time", time);
  return axios.post(url + "admin/WaterPackage/water_package_index", formdata);
}

//空桶用户列表
export function emptyBucket(
  token,
  page,
  limit,
  user_id,
  nickname,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("user_id", user_id);
  formdata.append("nickname", nickname);
  return axios.post(url + "admin/user/user_list", formdata);
}
// 空桶查看详情
export function emptyBarrel(token, page, limit, order_type, user_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("order_type", order_type);
  formdata.append("user_id", user_id);
  return axios.post(url + "admin/order/order_list_10", formdata);
}

//建材
//商品管理
//商品列表
export function productList(
  token,
  name,
  goods_no,
  brand_id,
  is_del,
  origin,
  category_ids,
  seller_shop_id,
  goods_id,
  page,
  pageSize,
  seller_id,
  is_fucai,
) {
  return axios.get(
    url +
    "admin/BuildingMaterialsGoods/index?token=" +
    token +
    "&name=" +
    name +
    "&goods_no=" +
    goods_no +
    "&brand_id=" +
    brand_id +
    "&is_del=" +
    is_del +
    "&origin=" +
    origin +
    "&category_ids=" +
    category_ids +
    "&seller_shop_id=" +
    seller_shop_id +
    "&goods_id=" +
    goods_id +
    "&page=" +
    page +
    "&pageSize=" +
    pageSize +
    "&seller_id=" +
    seller_id +
    "&is_fucai=" +
    is_fucai
  );
}

//添加
export function additionSave(
  token,
  id,
  name,
  color,
  brand_id,
  store_nums,
  origin,
  texture,
  model,
  weight,
  size,
  content,
  notice,
  sell_price,
  category_ids,
  img,
  unit,
  seller_shop_id,
  seller_id,
  unit_val,
  length,
  width,
  height,
  is_break,
  detail_chart,
  is_hot,
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("name", name);
  formdata.append("color", color);
  formdata.append("brand_id", brand_id);
  formdata.append("store_nums", store_nums);
  formdata.append("origin", origin);
  formdata.append("texture", texture);
  formdata.append("model", model);
  formdata.append("weight", weight);
  formdata.append("size", size);
  formdata.append("content", content);
  formdata.append("notice", notice);
  formdata.append("sell_price", sell_price);
  formdata.append("category_ids", category_ids);
  formdata.append("img", img);
  formdata.append("unit", unit);
  formdata.append("seller_shop_id", seller_shop_id);
  formdata.append("seller_id", seller_id);
  formdata.append("unit_val", unit_val);
  formdata.append("length", length);
  formdata.append("width", width);
  formdata.append("height", height);
  formdata.append("is_break", is_break);
  formdata.append("detail_chart", detail_chart);
  formdata.append("is_hot", is_hot);
  if (id) {
    formdata.append("id", id);
    return axios.post(url + "admin/BuildingMaterialsGoods/edit", formdata);
  }
  return axios.post(url + "admin/BuildingMaterialsGoods/save", formdata);
}

//类型
export function genreList(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/BuildingMaterialsCategory/category_tree", formdata);
}
//上下架
// admin/BuildingMaterialsGoods/edit_status?id=1
// export function edit_status(token, id, is_del) {
//   return axios.get(url + "admin/BuildingMaterialsGoods/editStatus?token=" + token + 'id=' + id + 'is_del=' + is_del);
// }
export function edit_status(token, id, is_del) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("is_del", is_del);
  return axios.post(url + "admin/BuildingMaterialsGoods/editStatus", formdata);
}
//删除
// admin/BuildingMaterialsGoods/delete
export function edit_remove(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/BuildingMaterialsGoods/delete", formdata);
}
//分类
//添加分类
export function Category(token, name, sort, visibility, img, parent_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("parent_id", parent_id);
  formdata.append("visibility", visibility);
  formdata.append("sort", sort);
  formdata.append("img", img);
  return axios.post(url + "admin/BuildingMaterialsCategory/save", formdata);
}

//建材分类列表
export function listDate(token, pageSize, name, id, page) {
  return axios.post(
    url +
    "admin/BuildingMaterialsCategory/index?token=" +
    token +
    "&pageSize=" +
    pageSize +
    "&name=" +
    name +
    "&id=" +
    id +
    "&page=" +
    page
  );
}

//编辑
export function redactEdit(token, id, name, sort, visibility, img, parent_id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("name", name);
  formdata.append("parent_id", parent_id);
  formdata.append("visibility", visibility);
  formdata.append("sort", sort);
  formdata.append("img", img);
  return axios.post(url + "admin/BuildingMaterialsCategory/edit", formdata);
}

//删除
export function deleteDate(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/BuildingMaterialsCategory/delete", formdata);
}

//品牌列表
export function bindBrand(id, token) {
  return axios.post(
    url + "admin/BuildingMaterialsCategory/get_bind_brand?category_id=" + id +
    "&token=" +
    token
  );
}

//品牌搜索
export function branDate(token, type, name) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("type", type);
  formdata.append("name", name);
  return axios.post(url + "admin/goods/brand_list", formdata);
}

//绑定品牌
export function binding(token, category_id, brand_ids) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("category_id", category_id);
  formdata.append("brand_ids", brand_ids);
  return axios.post(
    url + "admin/BuildingMaterialsCategory/bind_brand",
    formdata
  );
}

//绑定品牌
export function read(token, id) {
  return axios.get(url + "admin/BuildingMaterialsGoods/read?token=" + token + "&id=" +
    id);
}
//佣金提成
export function Performance(token, type = '') {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("type", type);
  return axios.post(url + "admin/goods_cat/workers_Performance", formdata);
}
//保存分类提成
export function addManCe(token, tbj_circle, tbj_ct_type, workers) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("tbj_circle", tbj_circle);
  formdata.append("tbj_ct_type", tbj_ct_type);
  formdata.append("workers", workers);
  return axios.post(url + "admin/goods_cat/up_workers_Performance", formdata);
}
//商品顶级
export function catDinJi(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + "admin/goods_cat/goods_cat_dinji", formdata);
}
//提成分类
export function upWokPer(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(
    url + "admin/goods_cat/tbj_workers_Performance_list",
    formdata
  );
}
export function marketPer(token) {
  let formdata = new FormData();
  formdata.append("token", token);
  return axios.post(url + 'admin/goods_cat/tbj_goods_Performance_list', formdata)
}
//编辑分类类型
export function wokPer(token, tbj_circle, tbj_ct_type, tbj_kt_price) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("tbj_circle", tbj_circle);
  formdata.append("tbj_ct_type", tbj_ct_type);
  formdata.append("tbj_kt_price", tbj_kt_price);
  return axios.post(url + "admin/goods_cat/up_wok_per", formdata);
}
export function wokPer1(token, tbj_goods_type, tbj_order_price) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("tbj_goods_type", tbj_goods_type);
  formdata.append("tbj_order_price", tbj_order_price);
  return axios.post(url + "admin/goods_cat/up_goods_per", formdata);
}
//提成商品列表
export function commission(token, page, limit, types, type) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("types", types);
  formdata.append("type", type);
  formdata.append("page", page);
  formdata.append("limit", limit);
  return axios.post(url + "admin/goods_cat/goods_Performance", formdata);
}
//编辑商品
export function products(token, id, data) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  formdata.append("data", data);
  return axios.post(url + "admin/goods_cat/up_goods_Performance", formdata);
}
//商家管理
export function merchant(
  token,
  company_name,
  seller_type,
  store_manager_name,
  store_manager_phone,
  is_lock,
  id,
  pageSize,
  page
) {
  return axios.get(
    url +
    "admin/Seller/index?token=" +
    token +
    "&company_name=" +
    company_name +
    "&seller_type=" +
    seller_type +
    "&store_manager_name=" +
    store_manager_name +
    "&store_manager_phone=" +
    store_manager_phone +
    "&is_lock=" +
    is_lock +
    "&id=" +
    id +
    "&pageSize=" +
    pageSize +
    "&page=" +
    page
  );
}
// lib/Common/get_area?parent_id=610000
//地区
export function region(token, parent_id) {
  return axios.get(url + "lib/Common/get_area?token=" + token + 'parent_id=' + parent_id);
}
//添加商家
export function addMerchant(
  type,
  token,
  role_id,
  shop_num,
  company_name,
  logo,
  telephone,
  password,
  seller_type,
  seller_type_data,
  divide,
  cooperation_expiration_date,
  paper_no,
  legal_person,
  legal_person_no_type,
  legal_person_no,
  set_up,
  registered_address,
  registered_capital,
  registered_capital_currency,
  operation_start,
  operation_end,
  hierarchical_organ,
  business_scope,
  paper_img,
  legal_person_img,
  charge_person_name,
  charge_person_phone,
  charge_person_wechat,
  charge_person_email,
  store_manager_name,
  store_manager_phone,
  store_manager_wechat,
  store_manager_email,
  account_bank,
  account_card_no,
  account_name,
  shop_address,
  longitude,//经度
  latitude,//维度
  shop_phone,
  shop_name,
  cate_ids,
  province,//省id
  city,//市id
  area,//区id
  id,//id
  seller_type_name,//顶级名称
) {
  let formdata = new FormData();
  formdata.append("type", type);
  formdata.append("token", token);
  formdata.append("role_id", role_id);
  formdata.append("shop_num", shop_num);
  formdata.append("company_name", company_name);
  formdata.append("logo", logo);
  formdata.append("telephone", telephone);
  formdata.append("password", password);
  formdata.append("seller_type", seller_type);
  formdata.append("seller_type_data", seller_type_data);
  formdata.append("divide", divide);
  formdata.append("cooperation_expiration_date", cooperation_expiration_date);
  formdata.append("paper_no", paper_no);
  formdata.append("legal_person", legal_person);
  formdata.append("legal_person_no_type", legal_person_no_type);
  formdata.append("legal_person_no", legal_person_no);
  formdata.append("set_up", set_up);
  formdata.append("registered_address", registered_address);
  formdata.append("registered_capital", registered_capital);
  formdata.append("registered_capital_currency", registered_capital_currency);
  formdata.append("operation_start", operation_start);
  formdata.append("operation_end", operation_end);
  formdata.append("hierarchical_organ", hierarchical_organ);
  formdata.append("business_scope", business_scope);
  formdata.append("paper_img", paper_img);
  formdata.append("legal_person_img", legal_person_img);
  formdata.append("charge_person_name", charge_person_name);
  formdata.append("charge_person_phone", charge_person_phone);
  formdata.append("charge_person_wechat", charge_person_wechat);
  formdata.append("charge_person_email", charge_person_email);
  formdata.append("store_manager_name", store_manager_name);
  formdata.append("store_manager_phone", store_manager_phone);
  formdata.append("store_manager_wechat", store_manager_wechat);
  formdata.append("store_manager_email", store_manager_email);
  formdata.append("account_bank", account_bank);
  formdata.append("account_card_no", account_card_no);
  formdata.append("account_name", account_name);
  formdata.append("shop_address", shop_address);
  formdata.append("longitude", longitude);
  formdata.append("latitude", latitude);
  formdata.append("shop_phone", shop_phone);
  formdata.append("shop_name", shop_name);
  formdata.append("cate_ids", cate_ids);
  formdata.append("province", province);
  formdata.append("city", city);
  formdata.append("area", area);
  formdata.append("seller_type_name", seller_type_name);
  if (type == 1) {
    return axios.post(url + "admin/Seller/save", formdata);
  } else {
    formdata.append("id", id);
    return axios.post(url + "admin/Seller/edit", formdata);
  }
}
//启用/停用
export function state(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/Seller/edit_status", formdata);
}
//详情
export function particulars(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/Seller/read", formdata);
}
//店铺列表
export function storeList(
  token,
  name,
  area,
  addesss,
  manager_name,
  manager_phone,
  pageSize,
  page
) {
  return axios.get(
    url +
    "admin/SellerShop/index?token=" +
    token +
    "&name=" +
    name +
    "&area=" +
    area +
    "&addesss=" +
    addesss +
    "&manager_name=" +
    manager_name +
    "&manager_phone=" +
    manager_phone
  );
}
//添加店铺
// admin/SellerShop/save
export function addShop(
  token,
  name,
  seller_id,
  province,
  city,
  area,
  addesss,
  seller_name,
  password,
  manager_name,
  manager_phone,
  telephone,
  img,
  details
) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("name", name);
  formdata.append("seller_id", seller_id);
  formdata.append("province", province);
  formdata.append("city", city);
  formdata.append("area", area);
  formdata.append("addesss", addesss);
  formdata.append("seller_name", seller_name);
  formdata.append("password", password);
  formdata.append("manager_name", manager_name);
  formdata.append("manager_phone", manager_phone);
  formdata.append("telephone", telephone);
  formdata.append("img", img);
  formdata.append("details", details);
  return axios.post(url + "admin/SellerShop/save", formdata);
}
//店铺状态
export function storeStatus(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/SellerShop/edit_status", formdata);
}
//店铺详情
// 
export function shopDetails(token, id) {
  return axios.get(url + "admin/SellerShop/read?token=" + token + "id=" + id);
}
//删除
export function StoreDeletion(token, id) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("id", id);
  return axios.post(url + "admin/SellerShop/delete", formdata);
}
//评价管理
export function management(
  token,
  company_name,
  manager_name,
  manager_phone,
  pageSize,
  page
) {
  return axios.get(
    url +
    "admin/Comment/index?token=" +
    token +
    "&company_name=" +
    company_name +
    "&manager_name=" +
    manager_name +
    "&manager_phone=" +
    manager_phone
  );
}
//员工详情
export function pingList(token, page, limit, time, user_id, status) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("time", time);
  formdata.append("user_id", user_id);
  formdata.append("status", status);
  return axios.post(url + "admin/user/user_pinglun_index_list", formdata);
}

//评价列表
export function evalList(token, page, limit, time, mobile, name) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("time", time);
  formdata.append("mobile", mobile);
  formdata.append("name", name);
  return axios.post(url + "admin/user/user_pinglun", formdata);
}
//员工建议
export function opinions(token, page, limit, time, mobile, name) {
  let formdata = new FormData();
  formdata.append("token", token);
  formdata.append("page", page);
  formdata.append("limit", limit);
  formdata.append("time", time);
  formdata.append("mobile", mobile);
  formdata.append("name", name);
  return axios.post(url + "admin/user/user_opinions", formdata);
}

export function deleteEvaluate(token, id) {
  let formatDate = new FormData();
  formatDate.append("token", token)
  formatDate.append("id", id)
  return axios.post(url + 'admin/user/pinglun_del', formatDate)
}

export function addMarketGoods(
  token,
  name,
  goods_cat_id,
  brand_id,
  brief,
  intro,
  price,
  costprice,
  mktprice,
  weight,
  stock,
  unit,
  images,
  marketable,
  is_hot,
  specifications,
  bn,
  goods_type_id,
  sell_num
) {
  let formatdate = new FormData()
  formatdate.append("token", token)
  formatdate.append("name", name)
  formatdate.append("goods_cat_id", goods_cat_id)
  formatdate.append("brand_id", brand_id)
  formatdate.append("brief", brief)
  formatdate.append("intro", intro)
  formatdate.append("price", price)
  formatdate.append("costprice", costprice)
  formatdate.append("mktprice", mktprice)
  formatdate.append("weight", weight)
  formatdate.append("stock", stock)
  formatdate.append("unit", unit)
  formatdate.append("images", images)
  formatdate.append("marketable", marketable)
  formatdate.append("is_hot", is_hot)
  formatdate.append("specifications", specifications)
  formatdate.append("bn", bn)
  formatdate.append("goods_type_id", goods_type_id)
  formatdate.append("sell_num", sell_num)
  return axios.post(url + 'admin/Goods/doAdd', formatdate)
}

// 超市商品出售预览表
export function goods_Sell_list(
  token,
  page,
  limit,
  name,
  type,
  time,
) {
  let formatdate = new FormData()
  formatdate.append("token", token)
  formatdate.append("name", name)
  formatdate.append("type", type)
  formatdate.append("time", time)
  formatdate.append("page", page)
  formatdate.append("limit", limit)
  return api.post(url + 'admin/goods/goods_Sell_list', formatdate)
}
export function marketTop(token) {
  let formdata = new FormData()
  formdata.append('token', token)
  return axios.post(url + 'admin/goodsCat/goods_cat_chaoshi', formdata)
}


// 建材订单列表
export function goodsOrder(
  token,
  user_id,
  order_id,
  seller_shop_name,
  status,
  ship_status,
  pay_status,
  mobile,
  page,
  limit,
) {
  let formatdate = new FormData()
  formatdate.append("token", token)
  formatdate.append("user_id", user_id)
  formatdate.append("order_id", order_id)
  formatdate.append("seller_shop_name", seller_shop_name)
  formatdate.append("status", status)
  formatdate.append("ship_status", ship_status)
  formatdate.append("pay_status", pay_status)
  formatdate.append("mobile", mobile)
  formatdate.append("page", page)
  formatdate.append("limit", limit)
  return axios.post(url + "admin/MaterialsOrder/getMaterialsOrderList", formatdate)
}

export function getWJD_and_WFH_num(
  token,
  ship_status,
  status,
  order_id,
  seller_shop_name,
  pay_status,
  mobile,
) {
  let formatdate = new FormData()
  formatdate.append("token", token)
  formatdate.append("ship_status", ship_status)
  formatdate.append("status", status)
  formatdate.append("order_id", order_id)
  formatdate.append("seller_shop_name", seller_shop_name)
  formatdate.append("pay_status", pay_status)
  formatdate.append("mobile", mobile)
  return axios.post(url + 'admin/MaterialsOrder/orderStatus', formatdate)
}
export function jiancaiOrderDetails(token, order_id) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("order_id", order_id)
  return axios.post(url + 'admin/MaterialsOrder/orderDetails', formdata)
}

// 手写下单详情  hjq
export function jiancaiHandeWrite(
  token,
  page,
  limit,
  shop_name,
  ship_mobile,
  ship_name,
  order_id,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("page", page)
  formdata.append("limit", limit)
  formdata.append("shop_name", shop_name)
  formdata.append("ship_mobile", ship_mobile)
  formdata.append("ship_name", ship_name)
  formdata.append("order_id", order_id)
  return axios.post(url + 'admin/MaterialsOrder/search_goods_list', formdata)
}
// 手写下单详情  jwq
export function writeJiancai(token, id) {
  let formdata = new FormData()
  formdata.append('token', token)
  formdata.append('id', id)
  return axios.post(url + 'admin/materials.Materials/getHandWrite', formdata)
}

export function getjiancaiGood(
  token,
  id
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("id", id)
  return axios.post(url + 'admin/MaterialsOrder/get_goodsinfo_by_catid', formdata)
}

// 提交手写下单
// admin/MaterialsOrder/search_goods_photo_list
export function submitWrite(
  token,
  id,
  goods_info,
  category_id,
  order_notes,
  user_id,
  authority_user_id
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("id", id)
  formdata.append("goods_info", goods_info)
  formdata.append("category_id", category_id)
  formdata.append("order_notes", order_notes)
  formdata.append("user_id", user_id)
  formdata.append("authority_user_id", authority_user_id)
  return axios.post(url + 'admin/MaterialsOrder/search_goods_commit', formdata)
}

export function serJiancaiOrder() {
  // admin/MaterialsOrder/edit

}
// 主材商家  新增商品
export function saveZhucaiGoods(
  token,
  name,
  unit,
  color,
  brand_id,
  category_id,
  sell_price,
  origin,
  texture,
  model,
  weight,
  is_break,
  is_join,
  store_nums,
  img,
  notice,
  detail_chart,
  unit_val,
  length,
  width,
  height,
  size,
  goods_no,
  seller_id,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("name", name)
  formdata.append("unit", unit)
  formdata.append("color", color)
  formdata.append("brand_id", brand_id)
  formdata.append("category_id", category_id)
  formdata.append("sell_price", sell_price)
  formdata.append("origin", origin)
  formdata.append("texture", texture)
  formdata.append("model", model)
  formdata.append("weight", weight)
  formdata.append("is_break", is_break)
  formdata.append("is_join", is_join)
  formdata.append("store_nums", store_nums)
  formdata.append("img", img)
  formdata.append("notice", notice)
  formdata.append("detail_chart", detail_chart)
  formdata.append("unit_val", unit_val)
  formdata.append("length", length)
  formdata.append("width", width)
  formdata.append("height", height)
  formdata.append("size", size)
  formdata.append("goods_no", goods_no)
  formdata.append("seller_id", seller_id)


  return axios.post(url + 'admin/materials.Materials/doMainsAdd', formdata)
}
// 主材商家  商品列表

export function getzhucaiList(
  token,
  seller_id,
  name,
  category_id,
  brand_id,
  is_del,
  page,
  pageSize
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("seller_id", seller_id)
  formdata.append("name", name)
  formdata.append("category_id", category_id)
  formdata.append("brand_id", brand_id)
  formdata.append("is_del", is_del)
  formdata.append("page", page)
  formdata.append("pageSize", pageSize)
  return axios.post(url + 'admin/materials.Materials/index', formdata)
}

export function shangxiajia(
  token,
  id,
  is_del
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("id", id)
  formdata.append("is_del", is_del)
  return axios.post(url + 'admin/materials.Materials/update_list_status', formdata)
}
// 主材商家 订单列表
export function merchantOrderList(
  token,
  seller_id,
  page,
  limit,
  shop_name,
  order_id,
  consignee,
  consignee_phone,
  status,
  pay_status,
  ship_status,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("seller_id", seller_id)
  formdata.append("page", page)
  formdata.append("limit", limit)
  formdata.append("shop_name", shop_name)
  formdata.append("order_id", order_id)
  formdata.append("consignee", consignee)
  formdata.append("consignee_phone", consignee_phone)
  formdata.append("status", status)
  formdata.append("pay_status", pay_status)
  formdata.append("ship_status", ship_status)
  return axios.post(url + 'admin/materials.Materials/getMainsOrderList', formdata)
}
// 设置菜单列表
export function menuList(token) {
  let formdata = new FormData()
  formdata.append("token", token)
  return axios.post(url + 'admin/user/limitsList', formdata)
}
export function addMenu(
  token,
  pid,
  name,
  url,
  url_name,
  sort,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("pid", pid)
  formdata.append("name", name)
  formdata.append("url", url)
  formdata.append("url_name", url_name)
  formdata.append("sort", sort)
  return axios.post(urls + 'admin/user/add_limits', formdata)
}
export function editMenu(
  type,
  token,
  pid,
  name,
  url,
  url_name,
  sort,
  is_del,
  id,
) {
  let formdata = new FormData()
  if (type == 1) { // 1编辑  2删除
    formdata.append("pid", pid)
    formdata.append("name", name)
    formdata.append("url", url)
    formdata.append("url_name", url_name)
    formdata.append("sort", sort)
  } else {
    formdata.append("is_del", is_del)
  }
  formdata.append("token", token)
  formdata.append("id", id)
  let data = {
    pid,
  name,
  url,
  url_name,
  sort,
  is_del,
  token,
  id,
  }
  console.log(data);
  return
  return axios.post(urls + 'admin/user/edit_limits', formdata)
}

export function accountNumberList(
  token,
  page,
  limit,
  user_name,
  phone,
  role_id,
  type
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("page", page)
  formdata.append("limit", limit)
  formdata.append("role_id", role_id)
  formdata.append("phone", phone)
  formdata.append("user_name", user_name)
  formdata.append("type", type)
  return axios.post(url + 'admin/user/admin_user_list', formdata)
}

// 获取所有角色列表
export function getAllUserList(
  token,
  type,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("type", type)
  return axios.post(url + 'admin/user/getRoleList', formdata)


}


// 获取水站超市单位
export function getGoodsUnit(
  token,
  page,
  limit,
  type,//1水站，2超市，3其他
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("page", page)
  formdata.append("limit", limit)
  formdata.append("type", type)
  return axios.post(url + 'admin/unit/unit_list', formdata)
}
// 添加水站超市品牌
export function addGoodsUnit(
  token,
  unit,
  sort,
  type,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("unit", unit)
  formdata.append("type", type)
  return axios.post(url + 'admin/unit/unit_add', formdata)
}
// 编辑水站超市品牌
export function setGoodsUnit(
  token,
  unit,
  sort,
  type,
  id
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("unit", unit)
  formdata.append("type", type)
  formdata.append("id", id)
  return axios.post(url + 'admin/unit/unit_up', formdata)
}
export function delGoodsUnit(
  token,
  id,
) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("id", id)
  return axios.post(url + 'admin/unit/unit_del', formdata)
}
export function getUnitList(token, type) {
  let formdata = new FormData()
  formdata.append("token", token)
  formdata.append("type", type)
  return axios.post(url + 'admin/unit/list', formdata)
}


export function indexee(time) {
  let formdata = new FormData()
  formdata.append("time", time)
  return axios.post(url + 'api/index/index1a', formdata)
}

